package ru.demo.abstarctservice.adapter.rabbit;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;

@Getter
public class RabbitMQEvent<Dto> extends ApplicationEvent {

    private static final String SERVICE_ROUTING_KEY = "abstract-service.changes.";

    private final Dto entityDto;
    private final String className;
    private final String routingKey;
    private final RabbitMQOperation operation;

    public RabbitMQEvent(Dto dto, String className, RabbitMQOperation operation) {
        super(dto);
        this.entityDto = dto;
        this.className = className.toLowerCase();
        this.routingKey = SERVICE_ROUTING_KEY + className.toLowerCase();
        this.operation = operation;
    }

}
